package com.sqfw.project.wpReport.controller;

import java.util.Comparator;
import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.sqfw.common.utils.StringUtils;
import com.sqfw.framework.web.domain.AjaxResult;
import com.sqfw.framework.web.page.TableDataInfo;
import com.sqfw.project.system.domain.SysDept;
import com.sqfw.project.system.domain.SysUser;
import com.sqfw.project.wp.domain.SysCode;
import com.sqfw.project.wp.domain.WpHandleLog;
import com.sqfw.project.wp.domain.WpInfo;
import com.sqfw.project.wp.domain.WpVisitInfo;
import com.sqfw.project.wpReport.domain.WpInfoDetail;
import com.sqfw.project.zj.domain.ZjRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.sqfw.framework.aspectj.lang.annotation.Log;
import com.sqfw.framework.aspectj.lang.enums.BusinessType;
import com.sqfw.project.wpReport.domain.WpInfoSatis;
import com.sqfw.project.wpReport.service.IWpInfoSatisService;
import com.sqfw.framework.web.controller.BaseController;
import com.sqfw.common.utils.poi.ExcelUtil;

/**
 * 市民满意度统计Controller
 * 
 * @author lx
 * @date 2023-07-21
 */
@RestController
@RequestMapping("/wpReport/wpInfoSatis")
public class WpInfoSatisController extends BaseController
{
    @Autowired
    private IWpInfoSatisService wpInfoSatisService;

    /**
     * 查询市民满意度统计列表
     */
    @PreAuthorize("@ss.hasPermi('getWpInfoSatisList')")
    @GetMapping("/getWpInfoSatisList")
    public AjaxResult getWpInfoSatisList(WpInfoSatis wpInfoSatis)
    {

        List<WpInfoSatis> wpInfoSatisList = wpInfoSatisService.getWpInfoSatisList(wpInfoSatis);
        return AjaxResult.success(wpInfoSatisList);
    }

    /**
     * 导出市民满意度统计列表
     */
    @Log(title = "市民满意度统计", businessType = BusinessType.EXPORT)
    @PreAuthorize("@ss.hasPermi('wpInfoSatis:export')")
    @PostMapping("/export")
    public void export(HttpServletResponse response, WpInfoSatis wpInfoSatis)
    {
        List<WpInfoSatis> list = wpInfoSatisService.getWpInfoSatisList(wpInfoSatis);
        ExcelUtil<WpInfoSatis> util = new ExcelUtil<WpInfoSatis>(WpInfoSatis.class);
        util.exportExcel(response, list, "市民满意度统计数据");
    }

    /**
     * 不满意件数详情
     * @return
     */
    @PreAuthorize("@ss.hasPermi('getUnSatisWpInfoList')")
    @GetMapping("/getUnSatisWpInfoList")
    public TableDataInfo getUnSatisWpInfoList(WpInfoDetail wpInfoDetail){

        startPage();

        List<WpInfoDetail> wpInfoDetails = wpInfoSatisService.getUnSatisWpInfoList(wpInfoDetail);
        return getDataTable(wpInfoDetails);

    }

    /**
     * 不满意件数详情
     * @return
     */
    @PreAuthorize("@ss.hasPermi('exportUnSatisWpInfoList')")
    @PostMapping("/exportUnSatisWpInfoList")
    public void exportUnSatisWpInfoList(HttpServletResponse response,WpInfoDetail wpInfoDetail){

        List<WpInfoDetail> wpInfoDetails = wpInfoSatisService.getUnSatisWpInfoList(wpInfoDetail);
        ExcelUtil<WpInfoDetail> util = new ExcelUtil<WpInfoDetail>(WpInfoDetail.class);
        util.exportExcel(response, wpInfoDetails, "市民不满意列表详情");

    }


}
